OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |