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

Side by Side Diff: Source/core/frame/LocalFrame.cpp

Issue 1170523002: Removing GraphicsContext from ImageBuffer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix for shape bug Created 5 years, 6 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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "core/paint/DeprecatedPaintLayer.h" 64 #include "core/paint/DeprecatedPaintLayer.h"
65 #include "core/paint/TransformRecorder.h" 65 #include "core/paint/TransformRecorder.h"
66 #include "core/svg/SVGDocumentExtensions.h" 66 #include "core/svg/SVGDocumentExtensions.h"
67 #include "platform/DragImage.h" 67 #include "platform/DragImage.h"
68 #include "platform/PluginScriptForbiddenScope.h" 68 #include "platform/PluginScriptForbiddenScope.h"
69 #include "platform/RuntimeEnabledFeatures.h" 69 #include "platform/RuntimeEnabledFeatures.h"
70 #include "platform/ScriptForbiddenScope.h" 70 #include "platform/ScriptForbiddenScope.h"
71 #include "platform/graphics/GraphicsContext.h" 71 #include "platform/graphics/GraphicsContext.h"
72 #include "platform/graphics/ImageBuffer.h" 72 #include "platform/graphics/ImageBuffer.h"
73 #include "platform/graphics/paint/ClipRecorder.h" 73 #include "platform/graphics/paint/ClipRecorder.h"
74 #include "platform/graphics/paint/DisplayItemListContextRecorder.h" 74 #include "platform/graphics/paint/SkPictureBuilder.h"
75 #include "platform/text/TextStream.h" 75 #include "platform/text/TextStream.h"
76 #include "wtf/PassOwnPtr.h" 76 #include "wtf/PassOwnPtr.h"
77 #include "wtf/StdLibExtras.h" 77 #include "wtf/StdLibExtras.h"
78 78
79 namespace blink { 79 namespace blink {
80 80
81 using namespace HTMLNames; 81 using namespace HTMLNames;
82 82
83 namespace { 83 namespace {
84 84
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 { 581 {
582 ASSERT(document()->isActive()); 582 ASSERT(document()->isActive());
583 float deviceScaleFactor = m_host->deviceScaleFactor(); 583 float deviceScaleFactor = m_host->deviceScaleFactor();
584 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); 584 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
585 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); 585 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
586 586
587 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(paintingRect.size()); 587 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(paintingRect.size());
588 if (!buffer) 588 if (!buffer)
589 return nullptr; 589 return nullptr;
590 590
591 SkPictureBuilder pictureBuilder(paintingRect);
591 { 592 {
592 DisplayItemListContextRecorder contextRecorder(*buffer->context()); 593 GraphicsContext& paintContext = pictureBuilder.context();
593 GraphicsContext& paintContext = contextRecorder.context();
594 594
595 AffineTransform transform; 595 AffineTransform transform;
596 transform.scale(deviceScaleFactor, deviceScaleFactor); 596 transform.scale(deviceScaleFactor, deviceScaleFactor);
597 transform.translate(-paintingRect.x(), -paintingRect.y()); 597 transform.translate(-paintingRect.x(), -paintingRect.y());
598 TransformRecorder transformRecorder(paintContext, displayItemClient, tra nsform); 598 TransformRecorder transformRecorder(paintContext, displayItemClient, tra nsform);
599 599
600 ClipRecorder clipRecorder(paintContext, displayItemClient, clipType, 600 ClipRecorder clipRecorder(paintContext, displayItemClient, clipType,
601 LayoutRect(0, 0, paintingRect.maxX(), paintingRect.maxY())); 601 LayoutRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
602 602
603 m_view->paintContents(&paintContext, paintingRect); 603 m_view->paintContents(&paintContext, paintingRect);
604
604 } 605 }
606 RefPtr<const SkPicture> recording = pictureBuilder.endRecording();
607 buffer->canvas()->drawPicture(recording.get());
605 608
606 RefPtr<Image> image = buffer->copyImage(); 609 RefPtr<Image> image = buffer->copyImage();
607 return DragImage::create(image.get(), shouldRespectImageOrientation, deviceS caleFactor); 610 return DragImage::create(image.get(), shouldRespectImageOrientation, deviceS caleFactor);
608 } 611 }
609 612
610 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) 613 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node)
611 { 614 {
612 if (!node.layoutObject()) 615 if (!node.layoutObject())
613 return nullptr; 616 return nullptr;
614 617
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 , m_textZoomFactor(parentTextZoomFactor(this)) 835 , m_textZoomFactor(parentTextZoomFactor(this))
833 , m_inViewSourceMode(false) 836 , m_inViewSourceMode(false)
834 { 837 {
835 if (isLocalRoot()) 838 if (isLocalRoot())
836 m_instrumentingAgents = InstrumentingAgents::create(); 839 m_instrumentingAgents = InstrumentingAgents::create();
837 else 840 else
838 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 841 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
839 } 842 }
840 843
841 } // namespace blink 844 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/ImageBitmap.cpp ('k') | Source/core/html/canvas/WebGLRenderingContextBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698