| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 sk_sp<SkColorSpace> colorSpace) | 45 sk_sp<SkColorSpace> colorSpace) |
| 46 : ImageBufferSurface(size, opacityMode, colorSpace) { | 46 : ImageBufferSurface(size, opacityMode, colorSpace) { |
| 47 SkAlphaType alphaType = | 47 SkAlphaType alphaType = |
| 48 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 48 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
| 49 SkImageInfo info = | 49 SkImageInfo info = |
| 50 SkImageInfo::MakeN32(size.width(), size.height(), alphaType, colorSpace); | 50 SkImageInfo::MakeN32(size.width(), size.height(), alphaType, colorSpace); |
| 51 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); | 51 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); |
| 52 m_surface = | 52 m_surface = |
| 53 SkSurface::MakeRaster(info, Opaque == opacityMode ? 0 : &disableLCDProps); | 53 SkSurface::MakeRaster(info, Opaque == opacityMode ? 0 : &disableLCDProps); |
| 54 | 54 |
| 55 // Always save an initial frame, to support resetting the top level matrix |
| 56 // and clip. |
| 57 if (m_surface) |
| 58 m_surface->getCanvas()->save(); |
| 59 |
| 55 if (initializationMode == InitializeImagePixels) { | 60 if (initializationMode == InitializeImagePixels) { |
| 56 if (m_surface) | 61 if (m_surface) |
| 57 clear(); | 62 clear(); |
| 58 } | 63 } |
| 59 } | 64 } |
| 60 | 65 |
| 61 UnacceleratedImageBufferSurface::~UnacceleratedImageBufferSurface() {} | 66 UnacceleratedImageBufferSurface::~UnacceleratedImageBufferSurface() {} |
| 62 | 67 |
| 63 SkCanvas* UnacceleratedImageBufferSurface::canvas() { | 68 SkCanvas* UnacceleratedImageBufferSurface::canvas() { |
| 64 return m_surface->getCanvas(); | 69 return m_surface->getCanvas(); |
| 65 } | 70 } |
| 66 | 71 |
| 67 bool UnacceleratedImageBufferSurface::isValid() const { | 72 bool UnacceleratedImageBufferSurface::isValid() const { |
| 68 return m_surface; | 73 return m_surface; |
| 69 } | 74 } |
| 70 | 75 |
| 71 sk_sp<SkImage> UnacceleratedImageBufferSurface::newImageSnapshot( | 76 sk_sp<SkImage> UnacceleratedImageBufferSurface::newImageSnapshot( |
| 72 AccelerationHint, | 77 AccelerationHint, |
| 73 SnapshotReason) { | 78 SnapshotReason) { |
| 74 return m_surface->makeImageSnapshot(); | 79 return m_surface->makeImageSnapshot(); |
| 75 } | 80 } |
| 76 | 81 |
| 77 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |