| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 SkBitmap bm; | 87 SkBitmap bm; |
| 88 if (as_IB(this)->getROPixels(&bm)) { | 88 if (as_IB(this)->getROPixels(&bm)) { |
| 89 return SkImageEncoder::EncodeData(bm, type, quality); | 89 return SkImageEncoder::EncodeData(bm, type, quality); |
| 90 } | 90 } |
| 91 return NULL; | 91 return NULL; |
| 92 } | 92 } |
| 93 | 93 |
| 94 /////////////////////////////////////////////////////////////////////////////// | 94 /////////////////////////////////////////////////////////////////////////////// |
| 95 | 95 |
| 96 static bool raster_canvas_supports(const SkImageInfo& info) { | 96 static bool raster_canvas_supports(const SkImageInfo& info) { |
| 97 switch (info.fColorType) { | 97 switch (info.colorType()) { |
| 98 case kN32_SkColorType: | 98 case kN32_SkColorType: |
| 99 return kUnpremul_SkAlphaType != info.fAlphaType; | 99 return kUnpremul_SkAlphaType != info.alphaType(); |
| 100 case kRGB_565_SkColorType: | 100 case kRGB_565_SkColorType: |
| 101 return true; | 101 return true; |
| 102 case kAlpha_8_SkColorType: | 102 case kAlpha_8_SkColorType: |
| 103 return true; | 103 return true; |
| 104 default: | 104 default: |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 return false; | 107 return false; |
| 108 } | 108 } |
| 109 | 109 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 131 | 131 |
| 132 SkCanvas canvas(*bitmap); | 132 SkCanvas canvas(*bitmap); |
| 133 | 133 |
| 134 SkPaint paint; | 134 SkPaint paint; |
| 135 paint.setXfermodeMode(SkXfermode::kClear_Mode); | 135 paint.setXfermodeMode(SkXfermode::kClear_Mode); |
| 136 canvas.drawRect(dstR, paint); | 136 canvas.drawRect(dstR, paint); |
| 137 | 137 |
| 138 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL
); | 138 const_cast<SkImage_Base*>(this)->onDrawRectToRect(&canvas, &srcR, dstR, NULL
); |
| 139 return true; | 139 return true; |
| 140 } | 140 } |
| OLD | NEW |