aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkImageGenerator.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-08-13 13:32:39 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-13 13:32:39 -0700
commit8f34372f7e97482e5e61ab298b7edaa008ba2f4c (patch)
tree48581497c1bcfb3420c6aba6c6fe27d344f96855 /src/core/SkImageGenerator.cpp
parent5a16cf654548190841b5af27af04e7995582ad7b (diff)
Extend SkImageGenerator to support natively generated GrTextures. As part of this, added uniqueID() to the generator, and made it be in the same namespace is bitmaps, pixelrefs, images.
To do this, create SkImageCacherator, which wraps a generator and provides an interface to get a cached answer for either the raster or texture output of the generator. BUG=skia: Review URL: https://codereview.chromium.org/1291803002
Diffstat (limited to 'src/core/SkImageGenerator.cpp')
-rw-r--r--src/core/SkImageGenerator.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index 82b42d7a97..d42ece828a 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -6,6 +6,12 @@
*/
#include "SkImageGenerator.h"
+#include "SkNextID.h"
+
+SkImageGenerator::SkImageGenerator(const SkImageInfo& info)
+ : fInfo(info)
+ , fUniqueID(SkNextID::ImageID())
+{}
bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) {
@@ -98,6 +104,13 @@ bool SkImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t
return this->onGetYUV8Planes(sizes, planes, rowBytes);
}
+GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType usage) {
+ if (!ctx) {
+ return nullptr;
+ }
+ return this->onGenerateTexture(ctx, usage);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////////
SkData* SkImageGenerator::onRefEncodedData() {