| 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" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "GrContext.h" | 12 #include "GrContext.h" |
| 13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
| 14 #include "SkGrPixelRef.h" | 14 #include "SkGrPixelRef.h" |
| 15 | 15 |
| 16 class SkImage_Gpu : public SkImage_Base { | 16 class SkImage_Gpu : public SkImage_Base { |
| 17 public: | 17 public: |
| 18 SK_DECLARE_INST_COUNT(SkImage_Gpu) | 18 SK_DECLARE_INST_COUNT(SkImage_Gpu) |
| 19 | 19 |
| 20 SkImage_Gpu(GrTexture*); | 20 SkImage_Gpu(GrTexture*); |
| 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 GrTexture* onGetTexture() SK_OVERRIDE; | 24 virtual GrTexture* onGetTexture() SK_OVERRIDE; |
| 25 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE { |
| 26 // TODO |
| 27 return false; |
| 28 } |
| 25 | 29 |
| 26 GrTexture* getTexture() { return fTexture; } | 30 GrTexture* getTexture() { return fTexture; } |
| 27 | 31 |
| 28 void setTexture(GrTexture* texture); | 32 void setTexture(GrTexture* texture); |
| 29 | 33 |
| 30 private: | 34 private: |
| 31 GrTexture* fTexture; | 35 GrTexture* fTexture; |
| 32 SkBitmap fBitmap; | 36 SkBitmap fBitmap; |
| 33 | 37 |
| 34 typedef SkImage_Base INHERITED; | 38 typedef SkImage_Base INHERITED; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return SkNEW_ARGS(SkImage_Gpu, (texture)); | 85 return SkNEW_ARGS(SkImage_Gpu, (texture)); |
| 82 } | 86 } |
| 83 | 87 |
| 84 GrTexture* SkTextureImageGetTexture(SkImage* image) { | 88 GrTexture* SkTextureImageGetTexture(SkImage* image) { |
| 85 return ((SkImage_Gpu*)image)->getTexture(); | 89 return ((SkImage_Gpu*)image)->getTexture(); |
| 86 } | 90 } |
| 87 | 91 |
| 88 void SkTextureImageSetTexture(SkImage* image, GrTexture* texture) { | 92 void SkTextureImageSetTexture(SkImage* image, GrTexture* texture) { |
| 89 ((SkImage_Gpu*)image)->setTexture(texture); | 93 ((SkImage_Gpu*)image)->setTexture(texture); |
| 90 } | 94 } |
| OLD | NEW |