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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkImagePriv.h" | 10 #include "SkImagePriv.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (as_IB(this)->getROPixels(&bm)) { | 83 if (as_IB(this)->getROPixels(&bm)) { |
84 return SkImageEncoder::EncodeData(bm, type, quality); | 84 return SkImageEncoder::EncodeData(bm, type, quality); |
85 } | 85 } |
86 return NULL; | 86 return NULL; |
87 } | 87 } |
88 | 88 |
89 /////////////////////////////////////////////////////////////////////////////// | 89 /////////////////////////////////////////////////////////////////////////////// |
90 | 90 |
91 static bool raster_canvas_supports(const SkImageInfo& info) { | 91 static bool raster_canvas_supports(const SkImageInfo& info) { |
92 switch (info.fColorType) { | 92 switch (info.fColorType) { |
93 case kPMColor_SkColorType: | 93 case kN32_SkColorType: |
94 return kUnpremul_SkAlphaType != info.fAlphaType; | 94 return kUnpremul_SkAlphaType != info.fAlphaType; |
95 case kRGB_565_SkColorType: | 95 case kRGB_565_SkColorType: |
96 return true; | 96 return true; |
97 case kAlpha_8_SkColorType: | 97 case kAlpha_8_SkColorType: |
98 return true; | 98 return true; |
99 default: | 99 default: |
100 break; | 100 break; |
101 } | 101 } |
102 return false; | 102 return false; |
103 } | 103 } |
(...skipping 25 matching lines...) Expand all Loading... |
129 | 129 |
130 SkCanvas canvas(*bitmap); | 130 SkCanvas canvas(*bitmap); |
131 | 131 |
132 SkPaint paint; | 132 SkPaint paint; |
133 paint.setXfermodeMode(SkXfermode::kClear_Mode); | 133 paint.setXfermodeMode(SkXfermode::kClear_Mode); |
134 canvas.drawRect(dstR, paint); | 134 canvas.drawRect(dstR, paint); |
135 | 135 |
136 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL
); | 136 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL
); |
137 return true; | 137 return true; |
138 } | 138 } |
OLD | NEW |