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

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

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: PaintRecord as typedef, fixup playback calls Created 3 years, 9 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return; 49 return;
50 GrContext* grContext = SharedGpuContext::gr(); 50 GrContext* grContext = SharedGpuContext::gr();
51 m_contextId = SharedGpuContext::contextId(); 51 m_contextId = SharedGpuContext::contextId();
52 CHECK(grContext); 52 CHECK(grContext);
53 53
54 SkAlphaType alphaType = 54 SkAlphaType alphaType =
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 = PaintSurface::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
65 m_canvas = WTF::wrapUnique(new PaintCanvas(m_surface->getCanvas()));
64 clear(); 66 clear();
65 67
66 // 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
67 // and clip. 69 // and clip.
68 m_surface->getCanvas()->save(); 70 m_canvas->save();
69 } 71 }
70 72
71 bool AcceleratedImageBufferSurface::isValid() const { 73 bool AcceleratedImageBufferSurface::isValid() const {
72 return m_surface && SharedGpuContext::isValid() && 74 return m_surface && SharedGpuContext::isValid() &&
73 m_contextId == SharedGpuContext::contextId(); 75 m_contextId == SharedGpuContext::contextId();
74 } 76 }
75 77
76 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint, 78 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint,
77 SnapshotReason) { 79 SnapshotReason) {
78 return m_surface->makeImageSnapshot(); 80 return m_surface->makeImageSnapshot();
79 } 81 }
80 82
81 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() { 83 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() {
82 if (!m_surface) 84 if (!m_surface)
83 return 0; 85 return 0;
84 return skia::GrBackendObjectToGrGLTextureInfo( 86 return skia::GrBackendObjectToGrGLTextureInfo(
85 m_surface->getTextureHandle( 87 m_surface->getTextureHandle(
86 PaintSurface::kDiscardWrite_TextureHandleAccess)) 88 SkSurface::kDiscardWrite_TextureHandleAccess))
87 ->fID; 89 ->fID;
88 } 90 }
89 91
90 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698