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

Side by Side Diff: sky/engine/core/html/HTMLCanvasElement.cpp

Issue 678483002: Remove RecordingImageBufferSurface (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | sky/engine/platform/BUILD.gn » ('j') | 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/html/canvas/WebGLContextAttributes.h" 44 #include "core/html/canvas/WebGLContextAttributes.h"
45 #include "core/html/canvas/WebGLContextEvent.h" 45 #include "core/html/canvas/WebGLContextEvent.h"
46 #include "core/html/canvas/WebGLRenderingContext.h" 46 #include "core/html/canvas/WebGLRenderingContext.h"
47 #include "core/rendering/RenderHTMLCanvas.h" 47 #include "core/rendering/RenderHTMLCanvas.h"
48 #include "core/rendering/RenderLayer.h" 48 #include "core/rendering/RenderLayer.h"
49 #include "platform/MIMETypeRegistry.h" 49 #include "platform/MIMETypeRegistry.h"
50 #include "platform/RuntimeEnabledFeatures.h" 50 #include "platform/RuntimeEnabledFeatures.h"
51 #include "platform/graphics/Canvas2DImageBufferSurface.h" 51 #include "platform/graphics/Canvas2DImageBufferSurface.h"
52 #include "platform/graphics/GraphicsContextStateSaver.h" 52 #include "platform/graphics/GraphicsContextStateSaver.h"
53 #include "platform/graphics/ImageBuffer.h" 53 #include "platform/graphics/ImageBuffer.h"
54 #include "platform/graphics/RecordingImageBufferSurface.h"
55 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 54 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
56 #include "platform/graphics/gpu/WebGLImageBufferSurface.h" 55 #include "platform/graphics/gpu/WebGLImageBufferSurface.h"
57 #include "platform/transforms/AffineTransform.h" 56 #include "platform/transforms/AffineTransform.h"
58 #include "public/platform/Platform.h" 57 #include "public/platform/Platform.h"
59 #include <math.h> 58 #include <math.h>
60 #include <v8.h> 59 #include <v8.h>
61 60
62 namespace blink { 61 namespace blink {
63 62
64 // These values come from the WhatWG spec. 63 // These values come from the WhatWG spec.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 452 }
454 453
455 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount) 454 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount)
456 { 455 {
457 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; 456 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque;
458 457
459 *msaaSampleCount = 0; 458 *msaaSampleCount = 0;
460 if (is3D()) 459 if (is3D())
461 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode)); 460 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode));
462 461
463 if (RuntimeEnabledFeatures::displayList2dCanvasEnabled()) {
464 OwnPtr<ImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSu rface(size(), opacityMode));
465 if (surface->isValid())
466 return surface.release();
467 }
468
469 if (shouldAccelerate(deviceSize)) { 462 if (shouldAccelerate(deviceSize)) {
470 if (document().settings()) 463 if (document().settings())
471 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount(); 464 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount();
472 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(size(), opacityMode, *msaaSampleCount)); 465 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(size(), opacityMode, *msaaSampleCount));
473 if (surface->isValid()) 466 if (surface->isValid())
474 return surface.release(); 467 return surface.release();
475 } 468 }
476 469
477 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode)); 470 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode));
478 } 471 }
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 } 708 }
716 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled); 709 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled);
717 } 710 }
718 711
719 FloatSize HTMLCanvasElement::sourceSize() const 712 FloatSize HTMLCanvasElement::sourceSize() const
720 { 713 {
721 return FloatSize(width(), height()); 714 return FloatSize(width(), height());
722 } 715 }
723 716
724 } 717 }
OLDNEW
« no previous file with comments | « no previous file | sky/engine/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698