| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, 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 24 matching lines...) Expand all Loading... |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 | 36 |
| 37 class SkCanvas; | 37 class SkCanvas; |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 UnacceleratedImageBufferSurface::UnacceleratedImageBufferSurface( | 41 UnacceleratedImageBufferSurface::UnacceleratedImageBufferSurface( |
| 42 const IntSize& size, | 42 const IntSize& size, |
| 43 OpacityMode opacityMode, | 43 OpacityMode opacityMode, |
| 44 ImageInitializationMode initializationMode, | 44 ImageInitializationMode initializationMode, |
| 45 sk_sp<SkColorSpace> colorSpace) | 45 sk_sp<SkColorSpace> colorSpace, |
| 46 : ImageBufferSurface(size, opacityMode, colorSpace) { | 46 SkColorType colorType) |
| 47 : ImageBufferSurface(size, opacityMode, colorSpace, colorType) { |
| 47 SkAlphaType alphaType = | 48 SkAlphaType alphaType = |
| 48 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 49 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
| 49 SkImageInfo info = | 50 SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, |
| 50 SkImageInfo::MakeN32(size.width(), size.height(), alphaType, colorSpace); | 51 alphaType, colorSpace); |
| 51 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); | 52 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); |
| 52 m_surface = | 53 m_surface = |
| 53 SkSurface::MakeRaster(info, Opaque == opacityMode ? 0 : &disableLCDProps); | 54 SkSurface::MakeRaster(info, Opaque == opacityMode ? 0 : &disableLCDProps); |
| 54 | 55 |
| 55 // Always save an initial frame, to support resetting the top level matrix | 56 // Always save an initial frame, to support resetting the top level matrix |
| 56 // and clip. | 57 // and clip. |
| 57 if (m_surface) | 58 if (m_surface) |
| 58 m_surface->getCanvas()->save(); | 59 m_surface->getCanvas()->save(); |
| 59 | 60 |
| 60 if (initializationMode == InitializeImagePixels) { | 61 if (initializationMode == InitializeImagePixels) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 73 return m_surface; | 74 return m_surface; |
| 74 } | 75 } |
| 75 | 76 |
| 76 sk_sp<SkImage> UnacceleratedImageBufferSurface::newImageSnapshot( | 77 sk_sp<SkImage> UnacceleratedImageBufferSurface::newImageSnapshot( |
| 77 AccelerationHint, | 78 AccelerationHint, |
| 78 SnapshotReason) { | 79 SnapshotReason) { |
| 79 return m_surface->makeImageSnapshot(); | 80 return m_surface->makeImageSnapshot(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |