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

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

Issue 2607373002: Linear filter for texture object in 2d context (Closed)
Patch Set: fix Created 3 years, 11 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 | « content/test/gpu/gpu_tests/pixel_test_pages.py ('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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" 5 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/quads/texture_draw_quad.h" 8 #include "cc/quads/texture_draw_quad.h"
9 #include "gpu/command_buffer/client/gles2_interface.h" 9 #include "gpu/command_buffer/client/gles2_interface.h"
10 #include "platform/CrossThreadFunctional.h" 10 #include "platform/CrossThreadFunctional.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 pass->SetNew(renderPassId, bounds, bounds, gfx::Transform()); 192 pass->SetNew(renderPassId, bounds, bounds, gfx::Transform());
193 pass->has_transparent_background = false; 193 pass->has_transparent_background = false;
194 194
195 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 195 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
196 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f, 196 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f,
197 SkBlendMode::kSrcOver, 0); 197 SkBlendMode::kSrcOver, 0);
198 198
199 cc::TransferableResource resource; 199 cc::TransferableResource resource;
200 resource.id = m_nextResourceId; 200 resource.id = m_nextResourceId;
201 resource.format = cc::ResourceFormat::RGBA_8888; 201 resource.format = cc::ResourceFormat::RGBA_8888;
202 // TODO(crbug.com/645590): filter should respect the image-rendering CSS
203 // property of associated canvas element.
204 resource.filter = GL_LINEAR;
205 resource.size = gfx::Size(m_width, m_height); 202 resource.size = gfx::Size(m_width, m_height);
206 // TODO(crbug.com/646022): making this overlay-able. 203 // TODO(crbug.com/646022): making this overlay-able.
207 resource.is_overlay_candidate = false; 204 resource.is_overlay_candidate = false;
208 205
209 bool yflipped = false; 206 bool yflipped = false;
210 OffscreenCanvasCommitType commitType; 207 OffscreenCanvasCommitType commitType;
211 DEFINE_THREAD_SAFE_STATIC_LOCAL( 208 DEFINE_THREAD_SAFE_STATIC_LOCAL(
212 EnumerationHistogram, commitTypeHistogram, 209 EnumerationHistogram, commitTypeHistogram,
213 new EnumerationHistogram("OffscreenCanvas.CommitType", 210 new EnumerationHistogram("OffscreenCanvas.CommitType",
214 OffscreenCanvasCommitTypeCount)); 211 OffscreenCanvasCommitTypeCount));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 261
265 const bool needsBlending = true; 262 const bool needsBlending = true;
266 // TOOD(crbug.com/645993): this should be inherited from WebGL context's 263 // TOOD(crbug.com/645993): this should be inherited from WebGL context's
267 // creation settings. 264 // creation settings.
268 const bool premultipliedAlpha = true; 265 const bool premultipliedAlpha = true;
269 const gfx::PointF uvTopLeft(0.f, 0.f); 266 const gfx::PointF uvTopLeft(0.f, 0.f);
270 const gfx::PointF uvBottomRight(1.f, 1.f); 267 const gfx::PointF uvBottomRight(1.f, 1.f);
271 float vertexOpacity[4] = {1.f, 1.f, 1.f, 1.f}; 268 float vertexOpacity[4] = {1.f, 1.f, 1.f, 1.f};
272 // TODO(crbug.com/645994): this should be true when using style 269 // TODO(crbug.com/645994): this should be true when using style
273 // "image-rendering: pixelated". 270 // "image-rendering: pixelated".
274 const bool nearestNeighbor = false; 271 const bool nearestNeighbor = false;
Justin Novosad 2017/01/06 20:06:01 What does this do?
xlai (Olivia) 2017/01/06 20:22:12 Oh it is actually doing the exact same thing as I'
275 quad->SetAll(sqs, bounds, bounds, bounds, needsBlending, resource.id, 272 quad->SetAll(sqs, bounds, bounds, bounds, needsBlending, resource.id,
276 gfx::Size(), premultipliedAlpha, uvTopLeft, uvBottomRight, 273 gfx::Size(), premultipliedAlpha, uvTopLeft, uvBottomRight,
277 SK_ColorTRANSPARENT, vertexOpacity, yflipped, nearestNeighbor, 274 SK_ColorTRANSPARENT, vertexOpacity, yflipped, nearestNeighbor,
278 false); 275 false);
276 // TODO(crbug.com/645590): filter should respect the image-rendering CSS
277 // property of associated canvas element.
278 quad->nearest_neighbor = false;
279 279
280 frame.render_pass_list.push_back(std::move(pass)); 280 frame.render_pass_list.push_back(std::move(pass));
281 281
282 double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime; 282 double elapsedTime = WTF::monotonicallyIncreasingTime() - commitStartTime;
283 283
284 switch (commitType) { 284 switch (commitType) {
285 case CommitGPUCanvasGPUCompositing: 285 case CommitGPUCanvasGPUCompositing:
286 if (isMainThread()) { 286 if (isMainThread()) {
287 DEFINE_STATIC_LOCAL( 287 DEFINE_STATIC_LOCAL(
288 CustomCountHistogram, commitGPUCanvasGPUCompositingMainTimer, 288 CustomCountHistogram, commitGPUCanvasGPUCompositingMainTimer,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { 413 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) {
414 if (m_width != width || m_height != height) { 414 if (m_width != width || m_height != height) {
415 m_width = width; 415 m_width = width;
416 m_height = height; 416 m_height = height;
417 m_changeSizeForNextCommit = true; 417 m_changeSizeForNextCommit = true;
418 } 418 }
419 } 419 }
420 420
421 } // namespace blink 421 } // namespace blink
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/pixel_test_pages.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698