| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 /////////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////////// |
| 39 | 39 |
| 40 SkImage_Gpu::SkImage_Gpu(GrTexture* texture) | 40 SkImage_Gpu::SkImage_Gpu(GrTexture* texture) |
| 41 : INHERITED(texture->width(), texture->height()) | 41 : INHERITED(texture->width(), texture->height()) |
| 42 , fTexture(texture) { | 42 , fTexture(texture) { |
| 43 | 43 |
| 44 SkASSERT(NULL != fTexture); | 44 SkASSERT(NULL != fTexture); |
| 45 fTexture->ref(); | 45 fTexture->ref(); |
| 46 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, fTexture->width(), fTexture->
height()); | 46 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, fTexture->width(), fTexture->
height()); |
| 47 fBitmap.setPixelRef(new SkGrPixelRef(fTexture))->unref(); | 47 fBitmap.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (fTexture)))->unref(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 SkImage_Gpu::~SkImage_Gpu() { | 50 SkImage_Gpu::~SkImage_Gpu() { |
| 51 SkSafeUnref(fTexture); | 51 SkSafeUnref(fTexture); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, | 54 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
| 55 const SkPaint* paint) { | 55 const SkPaint* paint) { |
| 56 canvas->drawBitmap(fBitmap, x, y, paint); | 56 canvas->drawBitmap(fBitmap, x, y, paint); |
| 57 } | 57 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 return SkNEW_ARGS(SkImage_Gpu, (texture)); | 76 return SkNEW_ARGS(SkImage_Gpu, (texture)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 GrTexture* SkTextureImageGetTexture(SkImage* image) { | 79 GrTexture* SkTextureImageGetTexture(SkImage* image) { |
| 80 return ((SkImage_Gpu*)image)->getTexture(); | 80 return ((SkImage_Gpu*)image)->getTexture(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SkTextureImageSetTexture(SkImage* image, GrTexture* texture) { | 83 void SkTextureImageSetTexture(SkImage* image, GrTexture* texture) { |
| 84 ((SkImage_Gpu*)image)->setTexture(texture); | 84 ((SkImage_Gpu*)image)->setTexture(texture); |
| 85 } | 85 } |
| OLD | NEW |