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

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

Issue 1195513002: Use SkImage snapshots for ImageBufferSurface texture access (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h ('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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SkAlphaType alphaType = (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPre mul_SkAlphaType; 55 SkAlphaType alphaType = (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPre mul_SkAlphaType;
56 SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), alphaTy pe); 56 SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), alphaTy pe);
57 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); 57 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry);
58 m_surface = adoptPtr(SkSurface::NewRenderTarget(grContext, SkSurface::kYes_B udgeted, info, 0 /* sampleCount */, 58 m_surface = adoptPtr(SkSurface::NewRenderTarget(grContext, SkSurface::kYes_B udgeted, info, 0 /* sampleCount */,
59 Opaque == opacityMode ? nullptr : &disableLCDProps)); 59 Opaque == opacityMode ? nullptr : &disableLCDProps));
60 if (!m_surface.get()) 60 if (!m_surface.get())
61 return; 61 return;
62 clear(); 62 clear();
63 } 63 }
64 64
65 Platform3DObject AcceleratedImageBufferSurface::getBackingTexture() const 65 // This is a duplicate of newImageSnapshot(), but we need different entry points to
66 // support Canvas2DLayerBridge's slightly divergent semantics.
reed1 2015/06/23 14:38:09 Lets document somewhere what those slightly diverg
67 PassRefPtr<SkImage> AcceleratedImageBufferSurface::getBackingTextureImage() cons t
66 { 68 {
67 // Before returning the texture, all drawing operations must be completed. 69 return adoptRef(m_surface->newImageSnapshot());
68 m_surface->getCanvas()->flush();
69 GrRenderTarget* renderTarget = m_surface->getCanvas()->getTopDevice()->acces sRenderTarget();
70 if (renderTarget) {
71 return renderTarget->asTexture()->getTextureHandle();
72 }
73 return 0;
74 } 70 }
75 71
76 void AcceleratedImageBufferSurface::didModifyBackingTexture() 72 void AcceleratedImageBufferSurface::didModifyBackingTexture()
77 { 73 {
78 m_surface->getCanvas()->getTopDevice()->accessBitmap(false).notifyPixelsChan ged(); 74 m_surface->getCanvas()->getTopDevice()->accessBitmap(false).notifyPixelsChan ged();
79 } 75 }
80 76
81 PassRefPtr<SkImage> AcceleratedImageBufferSurface::newImageSnapshot() const 77 PassRefPtr<SkImage> AcceleratedImageBufferSurface::newImageSnapshot() const
82 { 78 {
83 return adoptRef(m_surface->newImageSnapshot()); 79 return adoptRef(m_surface->newImageSnapshot());
84 } 80 }
85 81
86 } // namespace blink 82 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/gpu/AcceleratedImageBufferSurface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698