| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 55 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; |
| 56 SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, | 56 SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, |
| 57 alphaType, colorSpace); | 57 alphaType, colorSpace); |
| 58 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); | 58 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); |
| 59 m_surface = SkSurface::MakeRenderTarget( | 59 m_surface = SkSurface::MakeRenderTarget( |
| 60 grContext, SkBudgeted::kYes, info, 0 /* sampleCount */, | 60 grContext, SkBudgeted::kYes, info, 0 /* sampleCount */, |
| 61 Opaque == opacityMode ? nullptr : &disableLCDProps); | 61 Opaque == opacityMode ? nullptr : &disableLCDProps); |
| 62 if (!m_surface) | 62 if (!m_surface) |
| 63 return; | 63 return; |
| 64 | 64 |
| 65 m_canvas = WTF::wrapUnique(new PaintCanvas(m_surface->getCanvas())); | 65 m_canvas = WTF::wrapUnique(new SkiaPaintCanvas(m_surface->getCanvas())); |
| 66 clear(); | 66 clear(); |
| 67 | 67 |
| 68 // Always save an initial frame, to support resetting the top level matrix | 68 // Always save an initial frame, to support resetting the top level matrix |
| 69 // and clip. | 69 // and clip. |
| 70 m_canvas->save(); | 70 m_canvas->save(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool AcceleratedImageBufferSurface::isValid() const { | 73 bool AcceleratedImageBufferSurface::isValid() const { |
| 74 return m_surface && SharedGpuContext::isValid() && | 74 return m_surface && SharedGpuContext::isValid() && |
| 75 m_contextId == SharedGpuContext::contextId(); | 75 m_contextId == SharedGpuContext::contextId(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint, | 78 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint, |
| 79 SnapshotReason) { | 79 SnapshotReason) { |
| 80 return m_surface->makeImageSnapshot(); | 80 return m_surface->makeImageSnapshot(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() { | 83 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() { |
| 84 if (!m_surface) | 84 if (!m_surface) |
| 85 return 0; | 85 return 0; |
| 86 return skia::GrBackendObjectToGrGLTextureInfo( | 86 return skia::GrBackendObjectToGrGLTextureInfo( |
| 87 m_surface->getTextureHandle( | 87 m_surface->getTextureHandle( |
| 88 SkSurface::kDiscardWrite_TextureHandleAccess)) | 88 SkSurface::kDiscardWrite_TextureHandleAccess)) |
| 89 ->fID; | 89 ->fID; |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |