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

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

Issue 406673003: Add the method isOpaque() to SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase master Created 6 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/image/SkImage_Gpu.cpp ('k') | tests/ImageIsOpaqueTest.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 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 "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // exposed for SkSurface_Raster via SkNewImageFromPixelRef 64 // exposed for SkSurface_Raster via SkNewImageFromPixelRef
65 SkImage_Raster(const SkImageInfo&, SkPixelRef*, size_t rowBytes); 65 SkImage_Raster(const SkImageInfo&, SkPixelRef*, size_t rowBytes);
66 66
67 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } 67 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
68 68
69 virtual SkShader* onNewShader(SkShader::TileMode, 69 virtual SkShader* onNewShader(SkShader::TileMode,
70 SkShader::TileMode, 70 SkShader::TileMode,
71 const SkMatrix* localMatrix) const SK_OVERRIDE ; 71 const SkMatrix* localMatrix) const SK_OVERRIDE ;
72 72
73 virtual bool isOpaque() const SK_OVERRIDE;
74
73 SkImage_Raster(const SkBitmap& bm) 75 SkImage_Raster(const SkBitmap& bm)
74 : INHERITED(bm.width(), bm.height()) 76 : INHERITED(bm.width(), bm.height())
75 , fBitmap(bm) {} 77 , fBitmap(bm) {}
76 78
77 private: 79 private:
78 SkImage_Raster() : INHERITED(0, 0) {} 80 SkImage_Raster() : INHERITED(0, 0) {}
79 81
80 SkBitmap fBitmap; 82 SkBitmap fBitmap;
81 83
82 typedef SkImage_Base INHERITED; 84 typedef SkImage_Base INHERITED;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 214 }
213 215
214 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, 216 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
215 size_t rowBytes) { 217 size_t rowBytes) {
216 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); 218 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes));
217 } 219 }
218 220
219 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { 221 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) {
220 return ((SkImage_Raster*)image)->getPixelRef(); 222 return ((SkImage_Raster*)image)->getPixelRef();
221 } 223 }
224
225 bool SkImage_Raster::isOpaque() const {
226 return fBitmap.isOpaque();
227 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | tests/ImageIsOpaqueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698