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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 return fBitmap.copyTo(dst, kN32_SkColorType); | 82 return fBitmap.copyTo(dst, kN32_SkColorType); |
83 } | 83 } |
84 | 84 |
85 bool SkImage_Gpu::isOpaque() const { | 85 bool SkImage_Gpu::isOpaque() const { |
86 return fBitmap.isOpaque(); | 86 return fBitmap.isOpaque(); |
87 } | 87 } |
88 | 88 |
89 /////////////////////////////////////////////////////////////////////////////// | 89 /////////////////////////////////////////////////////////////////////////////// |
90 | 90 |
91 SkImage* SkNewImageFromBitmapTexture(const SkBitmap& bitmap, int sampleCountForN
ewSurfaces) { | 91 SkImage* SkNewImageFromBitmapTexture(const SkBitmap& bitmap, int sampleCountForN
ewSurfaces) { |
92 if (NULL == bitmap.getTexture()) { | 92 if (0 == bitmap.width() || 0 == bitmap.height() || NULL == bitmap.getTexture
()) { |
93 return NULL; | 93 return NULL; |
94 } | 94 } |
95 return SkNEW_ARGS(SkImage_Gpu, (bitmap, sampleCountForNewSurfaces)); | 95 return SkNEW_ARGS(SkImage_Gpu, (bitmap, sampleCountForNewSurfaces)); |
96 } | 96 } |
97 | 97 |
98 GrTexture* SkTextureImageGetTexture(SkImage* image) { | 98 GrTexture* SkTextureImageGetTexture(SkImage* image) { |
99 return ((SkImage_Gpu*)image)->getTexture(); | 99 return ((SkImage_Gpu*)image)->getTexture(); |
100 } | 100 } |
101 | 101 |
OLD | NEW |