| 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 13 matching lines...) Expand all Loading... |
| 24 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& ds
t, | 24 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& ds
t, |
| 25 const SkPaint*) const SK_OVERRIDE; | 25 const SkPaint*) const SK_OVERRIDE; |
| 26 virtual GrTexture* onGetTexture() const SK_OVERRIDE; | 26 virtual GrTexture* onGetTexture() const SK_OVERRIDE; |
| 27 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE; | 27 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE; |
| 28 | 28 |
| 29 GrTexture* getTexture() const { return fBitmap.getTexture(); } | 29 GrTexture* getTexture() const { return fBitmap.getTexture(); } |
| 30 | 30 |
| 31 virtual SkShader* onNewShader(SkShader::TileMode, | 31 virtual SkShader* onNewShader(SkShader::TileMode, |
| 32 SkShader::TileMode, | 32 SkShader::TileMode, |
| 33 const SkMatrix* localMatrix) const SK_OVERRIDE
; | 33 const SkMatrix* localMatrix) const SK_OVERRIDE
; |
| 34 |
| 35 virtual bool isOpaque() const SK_OVERRIDE; |
| 36 |
| 34 private: | 37 private: |
| 35 SkBitmap fBitmap; | 38 SkBitmap fBitmap; |
| 36 | 39 |
| 37 typedef SkImage_Base INHERITED; | 40 typedef SkImage_Base INHERITED; |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 /////////////////////////////////////////////////////////////////////////////// | 43 /////////////////////////////////////////////////////////////////////////////// |
| 41 | 44 |
| 42 SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap) | 45 SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap) |
| 43 : INHERITED(bitmap.width(), bitmap.height()) | 46 : INHERITED(bitmap.width(), bitmap.height()) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 } | 68 } |
| 66 | 69 |
| 67 GrTexture* SkImage_Gpu::onGetTexture() const { | 70 GrTexture* SkImage_Gpu::onGetTexture() const { |
| 68 return fBitmap.getTexture(); | 71 return fBitmap.getTexture(); |
| 69 } | 72 } |
| 70 | 73 |
| 71 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const { | 74 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const { |
| 72 return fBitmap.copyTo(dst, kN32_SkColorType); | 75 return fBitmap.copyTo(dst, kN32_SkColorType); |
| 73 } | 76 } |
| 74 | 77 |
| 78 bool SkImage_Gpu::isOpaque() const { |
| 79 return fBitmap.isOpaque(); |
| 80 } |
| 81 |
| 75 /////////////////////////////////////////////////////////////////////////////// | 82 /////////////////////////////////////////////////////////////////////////////// |
| 76 | 83 |
| 77 SkImage* SkImage::NewTexture(const SkBitmap& bitmap) { | 84 SkImage* SkImage::NewTexture(const SkBitmap& bitmap) { |
| 78 if (NULL == bitmap.getTexture()) { | 85 if (NULL == bitmap.getTexture()) { |
| 79 return NULL; | 86 return NULL; |
| 80 } | 87 } |
| 81 | 88 |
| 82 return SkNEW_ARGS(SkImage_Gpu, (bitmap)); | 89 return SkNEW_ARGS(SkImage_Gpu, (bitmap)); |
| 83 } | 90 } |
| 84 | 91 |
| 85 GrTexture* SkTextureImageGetTexture(SkImage* image) { | 92 GrTexture* SkTextureImageGetTexture(SkImage* image) { |
| 86 return ((SkImage_Gpu*)image)->getTexture(); | 93 return ((SkImage_Gpu*)image)->getTexture(); |
| 87 } | 94 } |
| OLD | NEW |