Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: src/core/SkImageGenerator.cpp

Issue 1291803002: Extend SkImageGenerator to support natively generated GrTextures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/core/SkPictureImageGenerator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImageGenerator.h" 8 #include "SkImageGenerator.h"
9 #include "SkNextID.h"
10
11 SkImageGenerator::SkImageGenerator(const SkImageInfo& info)
12 : fInfo(info)
13 , fUniqueID(SkNextID::ImageID())
14 {}
9 15
10 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes, 16 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r owBytes,
11 SkPMColor ctable[], int* ctableCount) { 17 SkPMColor ctable[], int* ctableCount) {
12 if (kUnknown_SkColorType == info.colorType()) { 18 if (kUnknown_SkColorType == info.colorType()) {
13 return false; 19 return false;
14 } 20 }
15 if (NULL == pixels) { 21 if (NULL == pixels) {
16 return false; 22 return false;
17 } 23 }
18 if (rowBytes < info.minRowBytes()) { 24 if (rowBytes < info.minRowBytes()) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // In order to maintain compatibility with clients that implemented the orig inal 97 // In order to maintain compatibility with clients that implemented the orig inal
92 // onGetYUV8Planes interface, we assume that the color space is JPEG. 98 // onGetYUV8Planes interface, we assume that the color space is JPEG.
93 // TODO(rileya): remove this and the old onGetYUV8Planes once clients switch over to 99 // TODO(rileya): remove this and the old onGetYUV8Planes once clients switch over to
94 // the new interface. 100 // the new interface.
95 if (colorSpace) { 101 if (colorSpace) {
96 *colorSpace = kJPEG_SkYUVColorSpace; 102 *colorSpace = kJPEG_SkYUVColorSpace;
97 } 103 }
98 return this->onGetYUV8Planes(sizes, planes, rowBytes); 104 return this->onGetYUV8Planes(sizes, planes, rowBytes);
99 } 105 }
100 106
107 GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType us age) {
108 if (!ctx) {
109 return nullptr;
110 }
111 return this->onGenerateTexture(ctx, usage);
112 }
113
101 //////////////////////////////////////////////////////////////////////////////// ///////////// 114 //////////////////////////////////////////////////////////////////////////////// /////////////
102 115
103 SkData* SkImageGenerator::onRefEncodedData() { 116 SkData* SkImageGenerator::onRefEncodedData() {
104 return NULL; 117 return NULL;
105 } 118 }
106 119
107 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb , 120 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb ,
108 SkPMColor* colors, int* colorCount) { 121 SkPMColor* colors, int* colorCount) {
109 return false; 122 return false;
110 } 123 }
(...skipping 16 matching lines...) Expand all
127 if (NULL == data) { 140 if (NULL == data) {
128 return NULL; 141 return NULL;
129 } 142 }
130 if (gFactory) { 143 if (gFactory) {
131 if (SkImageGenerator* generator = gFactory(data)) { 144 if (SkImageGenerator* generator = gFactory(data)) {
132 return generator; 145 return generator;
133 } 146 }
134 } 147 }
135 return SkImageGenerator::NewFromEncodedImpl(data); 148 return SkImageGenerator::NewFromEncodedImpl(data);
136 } 149 }
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/core/SkPictureImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698