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

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

Issue 1266143003: lock pixels in image when bitmap is immutable and not-lazy (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
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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 unrefCopy.reset(tex); 247 unrefCopy.reset(tex);
248 } 248 }
249 const SkImageInfo info = bm.info(); 249 const SkImageInfo info = bm.info();
250 return SkNEW_ARGS(SkImage_Gpu, (info.width(), info.height(), bm.getGener ationID(), 250 return SkNEW_ARGS(SkImage_Gpu, (info.width(), info.height(), bm.getGener ationID(),
251 info.alphaType(), tex, 0, SkSurface::kNo _Budgeted)); 251 info.alphaType(), tex, 0, SkSurface::kNo _Budgeted));
252 } 252 }
253 #endif 253 #endif
254 254
255 // This will check for immutable (share or copy) 255 // This will check for immutable (share or copy)
256 return SkNewImageFromRasterBitmap(bm, nullptr, kUnlocked_SharedPixelRefMode) ; 256 return SkNewImageFromRasterBitmap(bm, nullptr);
257 } 257 }
258 258
259 bool SkImage::asLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) const { 259 bool SkImage::asLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) const {
260 return as_IB(this)->onAsLegacyBitmap(bitmap, mode); 260 return as_IB(this)->onAsLegacyBitmap(bitmap, mode);
261 } 261 }
262 262
263 bool SkImage_Base::onAsLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) con st { 263 bool SkImage_Base::onAsLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) con st {
264 // As the base-class, all we can do is make a copy (regardless of mode). 264 // As the base-class, all we can do is make a copy (regardless of mode).
265 // Subclasses that want to be more optimal should override. 265 // Subclasses that want to be more optimal should override.
266 SkImageInfo info = SkImageInfo::MakeN32(this->width(), this->height(), 266 SkImageInfo info = SkImageInfo::MakeN32(this->width(), this->height(),
(...skipping 23 matching lines...) Expand all
290 290
291 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) { 291 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) {
292 return NULL; 292 return NULL;
293 } 293 }
294 294
295 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) { 295 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) {
296 return NULL; 296 return NULL;
297 } 297 }
298 298
299 #endif 299 #endif
OLDNEW
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/image/SkImagePriv.h » ('j') | tests/DeferredCanvasTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698