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

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

Issue 2425113002: Fix the linear-rgb canvas color space so that it renders (Closed)
Patch Set: 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
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 24 matching lines...) Expand all
35 #include "skia/ext/texture_handle.h" 35 #include "skia/ext/texture_handle.h"
36 #include "third_party/skia/include/gpu/GrContext.h" 36 #include "third_party/skia/include/gpu/GrContext.h"
37 #include "wtf/PtrUtil.h" 37 #include "wtf/PtrUtil.h"
38 #include "wtf/RefPtr.h" 38 #include "wtf/RefPtr.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 AcceleratedImageBufferSurface::AcceleratedImageBufferSurface( 42 AcceleratedImageBufferSurface::AcceleratedImageBufferSurface(
43 const IntSize& size, 43 const IntSize& size,
44 OpacityMode opacityMode, 44 OpacityMode opacityMode,
45 sk_sp<SkColorSpace> colorSpace) 45 sk_sp<SkColorSpace> colorSpace,
46 : ImageBufferSurface(size, opacityMode, colorSpace) { 46 SkColorType colorType)
47 : ImageBufferSurface(size, opacityMode, colorSpace, colorType) {
47 if (!SharedGpuContext::isValid()) 48 if (!SharedGpuContext::isValid())
48 return; 49 return;
49 GrContext* grContext = SharedGpuContext::gr(); 50 GrContext* grContext = SharedGpuContext::gr();
50 m_contextId = SharedGpuContext::contextId(); 51 m_contextId = SharedGpuContext::contextId();
51 CHECK(grContext); 52 CHECK(grContext);
52 53
53 SkAlphaType alphaType = 54 SkAlphaType alphaType =
54 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType; 55 (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
55 SkImageInfo info = 56 SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType,
56 SkImageInfo::MakeN32(size.width(), size.height(), alphaType); 57 alphaType, colorSpace);
57 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); 58 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry);
58 m_surface = SkSurface::MakeRenderTarget( 59 m_surface = SkSurface::MakeRenderTarget(
59 grContext, SkBudgeted::kYes, info, 0 /* sampleCount */, 60 grContext, SkBudgeted::kYes, info, 0 /* sampleCount */,
60 Opaque == opacityMode ? nullptr : &disableLCDProps); 61 Opaque == opacityMode ? nullptr : &disableLCDProps);
61 if (!m_surface) 62 if (!m_surface)
62 return; 63 return;
63 clear(); 64 clear();
64 65
65 // Always save an initial frame, to support resetting the top level matrix 66 // Always save an initial frame, to support resetting the top level matrix
66 // and clip. 67 // and clip.
(...skipping 13 matching lines...) Expand all
80 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() { 81 GLuint AcceleratedImageBufferSurface::getBackingTextureHandleForOverwrite() {
81 if (!m_surface) 82 if (!m_surface)
82 return 0; 83 return 0;
83 return skia::GrBackendObjectToGrGLTextureInfo( 84 return skia::GrBackendObjectToGrGLTextureInfo(
84 m_surface->getTextureHandle( 85 m_surface->getTextureHandle(
85 SkSurface::kDiscardWrite_TextureHandleAccess)) 86 SkSurface::kDiscardWrite_TextureHandleAccess))
86 ->fID; 87 ->fID;
87 } 88 }
88 89
89 } // namespace blink 90 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698