| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "core/platform/graphics/GraphicsContext.h" | 33 #include "core/platform/graphics/GraphicsContext.h" |
| 34 #include "core/platform/graphics/SimpleFontData.h" | 34 #include "core/platform/graphics/SimpleFontData.h" |
| 35 #include "core/platform/graphics/skia/SkiaUtils.h" | 35 #include "core/platform/graphics/skia/SkiaUtils.h" |
| 36 #include "core/platform/graphics/win/TransparencyWin.h" | 36 #include "core/platform/graphics/win/TransparencyWin.h" |
| 37 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 37 | 38 |
| 38 #include "SkColorPriv.h" | 39 #include "SkColorPriv.h" |
| 39 #include "skia/ext/platform_canvas.h" | 40 #include "skia/ext/platform_canvas.h" |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 // The maximum size in pixels of the buffer we'll keep around for drawing text | 46 // The maximum size in pixels of the buffer we'll keep around for drawing text |
| 46 // into. Buffers larger than this will be destroyed when we're done with them. | 47 // into. Buffers larger than this will be destroyed when we're done with them. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace | 97 } // namespace |
| 97 | 98 |
| 98 // If either of these pointers is non-null, both must be valid and point to | 99 // If either of these pointers is non-null, both must be valid and point to |
| 99 // bitmaps of the same size. | 100 // bitmaps of the same size. |
| 100 class TransparencyWin::OwnedBuffers { | 101 class TransparencyWin::OwnedBuffers { |
| 101 public: | 102 public: |
| 102 OwnedBuffers(const IntSize& size, bool needReferenceBuffer) | 103 OwnedBuffers(const IntSize& size, bool needReferenceBuffer) |
| 103 { | 104 { |
| 104 m_destBitmap = ImageBuffer::create(size, 1); | 105 OwnPtr<ImageBufferSurface> surface = adoptPtr(new UnacceleratedImageBuff
erSurface(size)); |
| 106 if (surface->isValid()) |
| 107 m_destBitmap = adoptPtr(new ImageBuffer(surface.release())); |
| 105 | 108 |
| 106 if (needReferenceBuffer) { | 109 if (needReferenceBuffer) { |
| 107 m_referenceBitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(
), size.height()); | 110 m_referenceBitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(
), size.height()); |
| 108 m_referenceBitmap.allocPixels(); | 111 m_referenceBitmap.allocPixels(); |
| 109 m_referenceBitmap.eraseARGB(0, 0, 0, 0); | 112 m_referenceBitmap.eraseARGB(0, 0, 0, 0); |
| 110 } | 113 } |
| 111 } | 114 } |
| 112 | 115 |
| 113 ImageBuffer* destBitmap() { return m_destBitmap.get(); } | 116 ImageBuffer* destBitmap() { return m_destBitmap.get(); } |
| 114 | 117 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 508 |
| 506 SkBitmap& bitmap = const_cast<SkBitmap&>(m_drawContext->layerBitmap(Graphics
Context::ReadWrite)); | 509 SkBitmap& bitmap = const_cast<SkBitmap&>(m_drawContext->layerBitmap(Graphics
Context::ReadWrite)); |
| 507 for (int y = 0; y < m_layerSize.height(); y++) { | 510 for (int y = 0; y < m_layerSize.height(); y++) { |
| 508 uint32_t* row = bitmap.getAddr32(0, y); | 511 uint32_t* row = bitmap.getAddr32(0, y); |
| 509 for (int x = 0; x < m_layerSize.width(); x++) | 512 for (int x = 0; x < m_layerSize.width(); x++) |
| 510 row[x] |= 0xFF000000; | 513 row[x] |= 0xFF000000; |
| 511 } | 514 } |
| 512 } | 515 } |
| 513 | 516 |
| 514 } // namespace WebCore | 517 } // namespace WebCore |
| OLD | NEW |