forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Ganesh Skp texture code into GrImageUtils
This is a follow-up to http://review.skia.org/673717 which makes SkPictureImageGenerator Ganesh-agnostic (and moves it to src/image/ so it can be closer to its friends). Change-Id: I61e0e8d5e026fd782da9651c4d90be51daee0734 Bug: skia:13983 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/678656 Commit-Queue: Kevin Lubick <[email protected]> Reviewed-by: Brian Osman <[email protected]>
- Loading branch information
Showing
14 changed files
with
232 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#include "src/image/SkImage_Picture.h" | ||
|
||
#include "include/core/SkColorSpace.h" | ||
#include "include/core/SkImage.h" | ||
#include "include/core/SkImageGenerator.h" | ||
#include "include/core/SkPicture.h" | ||
#include "include/core/SkSurfaceProps.h" | ||
#include "src/base/SkTLazy.h" | ||
#include "src/image/SkImageGeneratorPriv.h" | ||
#include "src/image/SkImage_Lazy.h" | ||
#include "src/image/SkPictureImageGenerator.h" | ||
|
||
#include <memory> | ||
#include <utility> | ||
|
||
class SkMatrix; | ||
class SkPaint; | ||
struct SkISize; | ||
|
||
sk_sp<SkImage> SkImage_Picture::Make(sk_sp<SkPicture> picture, const SkISize& dimensions, | ||
const SkMatrix* matrix, const SkPaint* paint, | ||
SkImages::BitDepth bitDepth, sk_sp<SkColorSpace> colorSpace, | ||
SkSurfaceProps props) { | ||
auto gen = SkImageGenerators::MakeFromPicture(dimensions, std::move(picture), matrix, paint, | ||
bitDepth, std::move(colorSpace), props); | ||
|
||
SkImage_Lazy::Validator validator( | ||
SharedGenerator::Make(std::move(gen)), nullptr, nullptr); | ||
|
||
return validator ? sk_make_sp<SkImage_Picture>(&validator) : nullptr; | ||
} | ||
|
||
SkPictureImageGenerator* SkImage_Picture::gen() const { | ||
return static_cast<SkPictureImageGenerator*>(this->generator()->fGenerator.get()); | ||
} | ||
|
||
SkPicture* SkImage_Picture::picture() const { | ||
return this->gen()->fPicture.get(); | ||
} | ||
|
||
SkMatrix* SkImage_Picture::matrix() const { | ||
return &this->gen()->fMatrix; | ||
} | ||
|
||
SkPaint* SkImage_Picture::paint() const { | ||
return this->gen()->fPaint.getMaybeNull(); | ||
} | ||
|
||
SkSurfaceProps* SkImage_Picture::props() const { | ||
return &this->gen()->fProps; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
#ifndef SkImage_Picture_DEFINED | ||
#define SkImage_Picture_DEFINED | ||
|
||
#include "include/core/SkRefCnt.h" | ||
#include "src/image/SkImage_Base.h" | ||
#include "src/image/SkImage_Lazy.h" | ||
|
||
class SkColorSpace; | ||
class SkImage; | ||
class SkMatrix; | ||
class SkPaint; | ||
class SkPicture; | ||
class SkPictureImageGenerator; | ||
class SkSurfaceProps; | ||
struct SkISize; | ||
|
||
namespace SkImages { enum class BitDepth; } | ||
|
||
class SkImage_Picture : public SkImage_Lazy { | ||
public: | ||
static sk_sp<SkImage> Make(sk_sp<SkPicture> picture, const SkISize& dimensions, | ||
const SkMatrix* matrix, const SkPaint* paint, | ||
SkImages::BitDepth bitDepth, sk_sp<SkColorSpace> colorSpace, | ||
SkSurfaceProps props); | ||
|
||
SkImage_Picture(Validator* validator) : SkImage_Lazy(validator) {} | ||
|
||
SkImage_Base::Type type() const override { return SkImage_Base::Type::kLazyPicture; } | ||
|
||
// These are not necessarily thread-safe. Be sure to grab the mutex from the shared | ||
// generator before accessing them. | ||
SkPicture* picture() const; | ||
SkMatrix* matrix() const; | ||
SkPaint* paint() const; | ||
SkSurfaceProps* props() const; | ||
|
||
private: | ||
SkPictureImageGenerator* gen() const; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.