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

Side by Side Diff: src/image/SkImage_Raster.cpp

Issue 1409923003: Revert of Rewrite GrTextureMaker to disentangle bitmap case from base class and give GPU object a say in what… (Closed) Base URL: https://skia.googlesource.com/skia.git@move
Patch Set: Created 5 years, 2 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/image/SkImage_Gpu.cpp ('k') | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkImage_Base.h" 8 #include "SkImage_Base.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 *dst = fBitmap; 166 *dst = fBitmap;
167 return true; 167 return true;
168 } 168 }
169 169
170 GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& p arams) const { 170 GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& p arams) const {
171 #if SK_SUPPORT_GPU 171 #if SK_SUPPORT_GPU
172 if (!ctx) { 172 if (!ctx) {
173 return nullptr; 173 return nullptr;
174 } 174 }
175 175
176 // textures (at least the texture-key) only support 16bit dimensions, so abo rt early
177 // if we're too big.
178 if (fBitmap.width() > 0xFFFF || fBitmap.height() > 0xFFFF) {
179 return nullptr;
180 }
181
182 GrUniqueKey key;
183 GrMakeKeyFromImageID(&key, fBitmap.getGenerationID(),
184 SkIRect::MakeWH(fBitmap.width(), fBitmap.height()),
185 *ctx->caps(), params);
186
187 if (GrTexture* tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(ke y)) {
188 return tex;
189 }
176 return GrRefCachedBitmapTexture(ctx, fBitmap, params); 190 return GrRefCachedBitmapTexture(ctx, fBitmap, params);
177 #endif 191 #endif
178 192
179 return nullptr; 193 return nullptr;
180 } 194 }
181 195
182 SkImage* SkImage_Raster::onNewSubset(const SkIRect& subset) const { 196 SkImage* SkImage_Raster::onNewSubset(const SkIRect& subset) const {
183 // TODO : could consider heurist of sharing pixels, if subset is pretty clos e to complete 197 // TODO : could consider heurist of sharing pixels, if subset is pretty clos e to complete
184 198
185 SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(), fBi tmap.alphaType()); 199 SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(), fBi tmap.alphaType());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // pixelref since the caller might call setImmutable() themselves 299 // pixelref since the caller might call setImmutable() themselves
286 // (thus changing our state). 300 // (thus changing our state).
287 if (fBitmap.isImmutable()) { 301 if (fBitmap.isImmutable()) {
288 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); 302 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes());
289 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); 303 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin());
290 return true; 304 return true;
291 } 305 }
292 } 306 }
293 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); 307 return this->INHERITED::onAsLegacyBitmap(bitmap, mode);
294 } 308 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698