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

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

Issue 406673003: Add the method isOpaque() to SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 "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 10 matching lines...) Expand all
21 virtual ~SkImage_Gpu(); 21 virtual ~SkImage_Gpu();
22 22
23 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OV ERRIDE; 23 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OV ERRIDE;
24 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& ds t, const SkPaint*) SK_OVERRIDE; 24 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& ds t, const SkPaint*) SK_OVERRIDE;
25 virtual GrTexture* onGetTexture() SK_OVERRIDE; 25 virtual GrTexture* onGetTexture() SK_OVERRIDE;
26 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE; 26 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE;
27 27
28 GrTexture* getTexture() { return fBitmap.getTexture(); } 28 GrTexture* getTexture() { return fBitmap.getTexture(); }
29 29
30 virtual SkShader* onNewShader(SkShader::TileMode, SkShader::TileMode) const SK_OVERRIDE; 30 virtual SkShader* onNewShader(SkShader::TileMode, SkShader::TileMode) const SK_OVERRIDE;
31
32 virtual bool isOpaque() const SK_OVERRIDE;
31 private: 33 private:
32 SkBitmap fBitmap; 34 SkBitmap fBitmap;
33 35
34 typedef SkImage_Base INHERITED; 36 typedef SkImage_Base INHERITED;
35 }; 37 };
36 38
37 /////////////////////////////////////////////////////////////////////////////// 39 ///////////////////////////////////////////////////////////////////////////////
38 40
39 SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap) 41 SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap)
40 : INHERITED(bitmap.width(), bitmap.height()) 42 : INHERITED(bitmap.width(), bitmap.height())
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (NULL == bitmap.getTexture()) { 75 if (NULL == bitmap.getTexture()) {
74 return NULL; 76 return NULL;
75 } 77 }
76 78
77 return SkNEW_ARGS(SkImage_Gpu, (bitmap)); 79 return SkNEW_ARGS(SkImage_Gpu, (bitmap));
78 } 80 }
79 81
80 GrTexture* SkTextureImageGetTexture(SkImage* image) { 82 GrTexture* SkTextureImageGetTexture(SkImage* image) {
81 return ((SkImage_Gpu*)image)->getTexture(); 83 return ((SkImage_Gpu*)image)->getTexture();
82 } 84 }
85
86 bool SkImage_Gpu::isOpaque() const {
87 return fBitmap.isOpaque();
88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698