Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp

Issue 2391373002: Refactor CRC2D::reset() to avoid non-additive SkCanvas state operations (Closed)
Patch Set: review Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 CHECK(grContext); 51 CHECK(grContext);
52 52
53 SkAlphaType alphaType = 53 SkAlphaType alphaType =
54 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; 54 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
55 SkImageInfo info = 55 SkImageInfo info =
56 SkImageInfo::MakeN32(size.width(), size.height(), alphaType); 56 SkImageInfo::MakeN32(size.width(), size.height(), alphaType);
57 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); 57 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry);
58 m_surface = SkSurface::MakeRenderTarget( 58 m_surface = SkSurface::MakeRenderTarget(
59 grContext, SkBudgeted::kYes, info, 0 /* sampleCount */, 59 grContext, SkBudgeted::kYes, info, 0 /* sampleCount */,
60 Opaque == opacityMode ? nullptr : &disableLCDProps); 60 Opaque == opacityMode ? nullptr : &disableLCDProps);
61 if (!m_surface.get()) 61 if (!m_surface)
62 return; 62 return;
63 clear(); 63 clear();
64
65 // Always save an initial frame, to support resetting the top level matrix
66 // and clip.
67 m_surface->getCanvas()->save();
64 } 68 }
65 69
66 bool AcceleratedImageBufferSurface::isValid() const { 70 bool AcceleratedImageBufferSurface::isValid() const {
67 return m_surface && SharedGpuContext::isValid() && 71 return m_surface && SharedGpuContext::isValid() &&
68 m_contextId == SharedGpuContext::contextId(); 72 m_contextId == SharedGpuContext::contextId();
69 } 73 }
70 74
71 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint, 75 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint,
72 SnapshotReason) { 76 SnapshotReason) {
73 return m_surface->makeImageSnapshot(); 77 return m_surface->makeImageSnapshot();
74 } 78 }
75 79
76 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() { 80 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() {
77 if (!m_surface) 81 if (!m_surface)
78 return 0; 82 return 0;
79 return skia::GrBackendObjectToGrGLTextureInfo( 83 return skia::GrBackendObjectToGrGLTextureInfo(
80 m_surface->getTextureHandle( 84 m_surface->getTextureHandle(
81 SkSurface::kDiscardWrite_TextureHandleAccess)) 85 SkSurface::kDiscardWrite_TextureHandleAccess))
82 ->fID; 86 ->fID;
83 } 87 }
84 88
85 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/UnacceleratedImageBufferSurface.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698