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

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

Issue 1301633002: Add subsets to SkImageGenerator and SkImageCacherator . (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix release-build warning 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
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" 9 #include "SkNextID.h"
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // 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
98 // onGetYUV8Planes interface, we assume that the color space is JPEG. 98 // onGetYUV8Planes interface, we assume that the color space is JPEG.
99 // 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
100 // the new interface. 100 // the new interface.
101 if (colorSpace) { 101 if (colorSpace) {
102 *colorSpace = kJPEG_SkYUVColorSpace; 102 *colorSpace = kJPEG_SkYUVColorSpace;
103 } 103 }
104 return this->onGetYUV8Planes(sizes, planes, rowBytes); 104 return this->onGetYUV8Planes(sizes, planes, rowBytes);
105 } 105 }
106 106
107 GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType us age) { 107 GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType us age,
108 if (!ctx) { 108 const SkIRect* subset) {
109 if (subset && !SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(*subs et)) {
109 return nullptr; 110 return nullptr;
110 } 111 }
111 return this->onGenerateTexture(ctx, usage); 112 return this->onGenerateTexture(ctx, usage, subset);
112 } 113 }
113 114
114 //////////////////////////////////////////////////////////////////////////////// ///////////// 115 //////////////////////////////////////////////////////////////////////////////// /////////////
115 116
116 SkData* SkImageGenerator::onRefEncodedData() { 117 SkData* SkImageGenerator::onRefEncodedData() {
117 return NULL; 118 return NULL;
118 } 119 }
119 120
120 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb , 121 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb ,
121 SkPMColor* colors, int* colorCount) { 122 SkPMColor* colors, int* colorCount) {
(...skipping 18 matching lines...) Expand all
140 if (NULL == data) { 141 if (NULL == data) {
141 return NULL; 142 return NULL;
142 } 143 }
143 if (gFactory) { 144 if (gFactory) {
144 if (SkImageGenerator* generator = gFactory(data)) { 145 if (SkImageGenerator* generator = gFactory(data)) {
145 return generator; 146 return generator;
146 } 147 }
147 } 148 }
148 return SkImageGenerator::NewFromEncodedImpl(data); 149 return SkImageGenerator::NewFromEncodedImpl(data);
149 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698