| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
| 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 bool is_opaque, bool do_clear = false); | 39 bool is_opaque, bool do_clear = false); |
| 40 | 40 |
| 41 // Creates a context for |data| and calls Create. | 41 // Creates a context for |data| and calls Create. |
| 42 // If |data| is NULL, then the bitmap backing store is not initialized. | 42 // If |data| is NULL, then the bitmap backing store is not initialized. |
| 43 static BitmapPlatformDevice* CreateWithData(uint8_t* data, | 43 static BitmapPlatformDevice* CreateWithData(uint8_t* data, |
| 44 int width, int height, | 44 int width, int height, |
| 45 bool is_opaque); | 45 bool is_opaque); |
| 46 | 46 |
| 47 ~BitmapPlatformDevice() override; | 47 ~BitmapPlatformDevice() override; |
| 48 | 48 |
| 49 // PlatformDevice overrides | |
| 50 CGContextRef GetBitmapContext(const SkMatrix& transform, | |
| 51 const SkIRect& clip_bounds) override; | |
| 52 | |
| 53 protected: | 49 protected: |
| 54 BitmapPlatformDevice(CGContextRef context, | 50 BitmapPlatformDevice(CGContextRef context, |
| 55 const SkBitmap& bitmap); | 51 const SkBitmap& bitmap); |
| 56 | 52 |
| 57 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; | 53 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; |
| 58 | 54 |
| 59 private: | 55 private: |
| 56 NativeDrawingContext BeginPlatformPaint(const SkMatrix& transform, |
| 57 const SkIRect& clip_bounds) override; |
| 58 |
| 60 void ReleaseBitmapContext(); | 59 void ReleaseBitmapContext(); |
| 61 | 60 |
| 62 // Loads the current transform and clip into the context. Can be called even | 61 // Loads the current transform and clip into the context. Can be called even |
| 63 // when |bitmap_context_| is NULL (will be a NOP). | 62 // when |bitmap_context_| is NULL (will be a NOP). |
| 64 void LoadConfig(const SkMatrix& transform, const SkIRect& clip_bounds); | 63 void LoadConfig(const SkMatrix& transform, const SkIRect& clip_bounds); |
| 65 | 64 |
| 66 // Lazily-created graphics context used to draw into the bitmap. | 65 // Lazily-created graphics context used to draw into the bitmap. |
| 67 CGContextRef bitmap_context_; | 66 CGContextRef bitmap_context_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); | 68 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 } // namespace skia | 71 } // namespace skia |
| 73 | 72 |
| 74 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ | 73 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
| OLD | NEW |