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

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

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: Rebase 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 || !m_surface->getCanvas())
danakj 2017/03/02 19:44:40 I don't see how m_surface can return a null canvas
enne (OOO) 2017/03/02 23:59:44 Good catch. Removed this.
63 return; 63 return;
64 m_canvas = WTF::wrapUnique(new PaintCanvas(m_surface->getCanvas()));
64 clear(); 65 clear();
65 66
66 // Always save an initial frame, to support resetting the top level matrix 67 // Always save an initial frame, to support resetting the top level matrix
67 // and clip. 68 // and clip.
68 m_surface->getCanvas()->save(); 69 m_canvas->save();
69 } 70 }
70 71
71 bool AcceleratedImageBufferSurface::isValid() const { 72 bool AcceleratedImageBufferSurface::isValid() const {
72 return m_surface && SharedGpuContext::isValid() && 73 return m_surface && SharedGpuContext::isValid() &&
73 m_contextId == SharedGpuContext::contextId(); 74 m_contextId == SharedGpuContext::contextId();
74 } 75 }
75 76
76 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint, 77 sk_sp<SkImage> AcceleratedImageBufferSurface::newImageSnapshot(AccelerationHint,
77 SnapshotReason) { 78 SnapshotReason) {
78 return m_surface->makeImageSnapshot(); 79 return m_surface->makeImageSnapshot();
79 } 80 }
80 81
81 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() { 82 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() {
82 if (!m_surface) 83 if (!m_surface)
83 return 0; 84 return 0;
84 return skia::GrBackendObjectToGrGLTextureInfo( 85 return skia::GrBackendObjectToGrGLTextureInfo(
85 m_surface->getTextureHandle( 86 m_surface->getTextureHandle(
86 PaintSurface::kDiscardWrite_TextureHandleAccess)) 87 SkSurface::kDiscardWrite_TextureHandleAccess))
87 ->fID; 88 ->fID;
88 } 89 }
89 90
90 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698