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

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 379253002: Initial implementation of display list backed 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tiny fix Created 6 years, 5 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 | Annotate | Revision Log
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 30 matching lines...) Expand all
41 #include "core/html/canvas/CanvasRenderingContext2D.h" 41 #include "core/html/canvas/CanvasRenderingContext2D.h"
42 #include "core/html/canvas/WebGLContextAttributes.h" 42 #include "core/html/canvas/WebGLContextAttributes.h"
43 #include "core/html/canvas/WebGLContextEvent.h" 43 #include "core/html/canvas/WebGLContextEvent.h"
44 #include "core/html/canvas/WebGLRenderingContext.h" 44 #include "core/html/canvas/WebGLRenderingContext.h"
45 #include "core/rendering/RenderHTMLCanvas.h" 45 #include "core/rendering/RenderHTMLCanvas.h"
46 #include "platform/MIMETypeRegistry.h" 46 #include "platform/MIMETypeRegistry.h"
47 #include "platform/RuntimeEnabledFeatures.h" 47 #include "platform/RuntimeEnabledFeatures.h"
48 #include "platform/graphics/Canvas2DImageBufferSurface.h" 48 #include "platform/graphics/Canvas2DImageBufferSurface.h"
49 #include "platform/graphics/GraphicsContextStateSaver.h" 49 #include "platform/graphics/GraphicsContextStateSaver.h"
50 #include "platform/graphics/ImageBuffer.h" 50 #include "platform/graphics/ImageBuffer.h"
51 #include "platform/graphics/RecordingImageBufferSurface.h"
51 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 52 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
52 #include "platform/graphics/gpu/WebGLImageBufferSurface.h" 53 #include "platform/graphics/gpu/WebGLImageBufferSurface.h"
53 #include "platform/transforms/AffineTransform.h" 54 #include "platform/transforms/AffineTransform.h"
54 #include "public/platform/Platform.h" 55 #include "public/platform/Platform.h"
55 #include <math.h> 56 #include <math.h>
56 #include <v8.h> 57 #include <v8.h>
57 58
58 namespace WebCore { 59 namespace WebCore {
59 60
60 using namespace HTMLNames; 61 using namespace HTMLNames;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 438 }
438 439
439 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount) 440 PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const IntSize& deviceSize, int* msaaSampleCount)
440 { 441 {
441 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; 442 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque;
442 443
443 *msaaSampleCount = 0; 444 *msaaSampleCount = 0;
444 if (is3D()) 445 if (is3D())
445 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode)); 446 return adoptPtr(new WebGLImageBufferSurface(size(), opacityMode));
446 447
448 if (document().settings() && document().settings()->displayList2dCanvasEnabl ed()) {
449 OwnPtr<ImageBufferSurface> surface = adoptPtr(new RecordingImageBufferSu rface(size(), opacityMode));
450 if (surface->isValid())
451 return surface.release();
452 }
453
447 if (shouldAccelerate(deviceSize)) { 454 if (shouldAccelerate(deviceSize)) {
448 if (document().settings()) 455 if (document().settings())
449 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount(); 456 *msaaSampleCount = document().settings()->accelerated2dCanvasMSAASam pleCount();
450 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(size(), opacityMode, *msaaSampleCount)); 457 OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSur face(size(), opacityMode, *msaaSampleCount));
451 if (surface->isValid()) 458 if (surface->isValid())
452 return surface.release(); 459 return surface.release();
453 } 460 }
454 461
455 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode)); 462 return adoptPtr(new UnacceleratedImageBufferSurface(size(), opacityMode));
456 } 463 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 { 701 {
695 return !originClean(); 702 return !originClean();
696 } 703 }
697 704
698 FloatSize HTMLCanvasElement::sourceSize() const 705 FloatSize HTMLCanvasElement::sourceSize() const
699 { 706 {
700 return FloatSize(width(), height()); 707 return FloatSize(width(), height());
701 } 708 }
702 709
703 } 710 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698