| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "skia/ext/bitmap_platform_device_mac.h" | 5 #include "skia/ext/bitmap_platform_device_mac.h" |
| 6 | 6 |
| 7 #include "skia/ext/skia_utils_mac.h" | 7 #include "skia/ext/skia_utils_mac.h" |
| 8 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
| 9 #include "SkPath.h" | 9 #include "SkPath.h" |
| 10 #include "SkTypes.h" | 10 #include "SkTypes.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 if (*size > 0 && *position < available_size) { | 26 if (*size > 0 && *position < available_size) { |
| 27 int overflow = (*position + *size) - available_size; | 27 int overflow = (*position + *size) - available_size; |
| 28 if (overflow > 0) { | 28 if (overflow > 0) { |
| 29 *size -= overflow; | 29 *size -= overflow; |
| 30 } | 30 } |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 return false; | 33 return false; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Sets the opacity of the specified value to 0xFF. | |
| 37 void makeOpaqueAlphaAdjuster(uint32_t* pixel) { | |
| 38 *pixel |= 0xFF000000; | |
| 39 } | |
| 40 | |
| 41 } // namespace | 36 } // namespace |
| 42 | 37 |
| 43 PlatformDeviceMac::PlatformDeviceMac(const SkBitmap& bitmap) | 38 PlatformDeviceMac::PlatformDeviceMac(const SkBitmap& bitmap) |
| 44 : SkDevice(bitmap) { | 39 : SkDevice(bitmap) { |
| 45 } | 40 } |
| 46 | 41 |
| 47 void PlatformDeviceMac::makeOpaque(int x, int y, int width, int height) { | |
| 48 processPixels(x, y, width, height, makeOpaqueAlphaAdjuster); | |
| 49 } | |
| 50 | |
| 51 // Set up the CGContextRef for peaceful coexistence with Skia | 42 // Set up the CGContextRef for peaceful coexistence with Skia |
| 52 void PlatformDeviceMac::InitializeCGContext(CGContextRef context) { | 43 void PlatformDeviceMac::InitializeCGContext(CGContextRef context) { |
| 53 // CG defaults to the same settings as Skia | 44 // CG defaults to the same settings as Skia |
| 54 } | 45 } |
| 55 | 46 |
| 56 // static | 47 // static |
| 57 void PlatformDeviceMac::LoadPathToCGContext(CGContextRef context, | 48 void PlatformDeviceMac::LoadPathToCGContext(CGContextRef context, |
| 58 const SkPath& path) { | 49 const SkPath& path) { |
| 59 // instead of a persistent attribute of the context, CG specifies the fill | 50 // instead of a persistent attribute of the context, CG specifies the fill |
| 60 // type per call, so we just have to load up the geometry. | 51 // type per call, so we just have to load up the geometry. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 path.transform(transformation); | 146 path.transform(transformation); |
| 156 // TODO(playmobil): Implement. | 147 // TODO(playmobil): Implement. |
| 157 SkASSERT(false); | 148 SkASSERT(false); |
| 158 // LoadPathToDC(context, path); | 149 // LoadPathToDC(context, path); |
| 159 // hrgn = PathToRegion(context); | 150 // hrgn = PathToRegion(context); |
| 160 } | 151 } |
| 161 } | 152 } |
| 162 | 153 |
| 163 } // namespace skia | 154 } // namespace skia |
| 164 | 155 |
| OLD | NEW |