| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "platform/Histogram.h" | 67 #include "platform/Histogram.h" |
| 68 #include "platform/RuntimeEnabledFeatures.h" | 68 #include "platform/RuntimeEnabledFeatures.h" |
| 69 #include "platform/graphics/Canvas2DImageBufferSurface.h" | 69 #include "platform/graphics/Canvas2DImageBufferSurface.h" |
| 70 #include "platform/graphics/CanvasMetrics.h" | 70 #include "platform/graphics/CanvasMetrics.h" |
| 71 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 71 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 72 #include "platform/graphics/ImageBuffer.h" | 72 #include "platform/graphics/ImageBuffer.h" |
| 73 #include "platform/graphics/RecordingImageBufferSurface.h" | 73 #include "platform/graphics/RecordingImageBufferSurface.h" |
| 74 #include "platform/graphics/StaticBitmapImage.h" | 74 #include "platform/graphics/StaticBitmapImage.h" |
| 75 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 75 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 76 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" | 76 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" |
| 77 #include "platform/graphics/gpu/SharedGpuContext.h" |
| 77 #include "platform/graphics/paint/PaintCanvas.h" | 78 #include "platform/graphics/paint/PaintCanvas.h" |
| 78 #include "platform/image-encoders/ImageEncoderUtils.h" | 79 #include "platform/image-encoders/ImageEncoderUtils.h" |
| 79 #include "platform/transforms/AffineTransform.h" | 80 #include "platform/transforms/AffineTransform.h" |
| 80 #include "platform/wtf/CheckedNumeric.h" | 81 #include "platform/wtf/CheckedNumeric.h" |
| 81 #include "platform/wtf/PtrUtil.h" | 82 #include "platform/wtf/PtrUtil.h" |
| 82 #include "public/platform/Platform.h" | 83 #include "public/platform/Platform.h" |
| 83 #include "public/platform/WebTraceLocation.h" | 84 #include "public/platform/WebTraceLocation.h" |
| 84 #include "v8/include/v8.h" | 85 #include "v8/include/v8.h" |
| 85 | 86 |
| 86 namespace blink { | 87 namespace blink { |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 } | 1234 } |
| 1234 | 1235 |
| 1235 void HTMLCanvasElement::DidMoveToNewDocument(Document& old_document) { | 1236 void HTMLCanvasElement::DidMoveToNewDocument(Document& old_document) { |
| 1236 ContextLifecycleObserver::SetContext(&GetDocument()); | 1237 ContextLifecycleObserver::SetContext(&GetDocument()); |
| 1237 PageVisibilityObserver::SetContext(GetDocument().GetPage()); | 1238 PageVisibilityObserver::SetContext(GetDocument().GetPage()); |
| 1238 HTMLElement::DidMoveToNewDocument(old_document); | 1239 HTMLElement::DidMoveToNewDocument(old_document); |
| 1239 } | 1240 } |
| 1240 | 1241 |
| 1241 void HTMLCanvasElement::WillDrawImageTo2DContext(CanvasImageSource* source) { | 1242 void HTMLCanvasElement::WillDrawImageTo2DContext(CanvasImageSource* source) { |
| 1242 if (ExpensiveCanvasHeuristicParameters::kEnableAccelerationToAvoidReadbacks && | 1243 if (ExpensiveCanvasHeuristicParameters::kEnableAccelerationToAvoidReadbacks && |
| 1244 SharedGpuContext::AllowSoftwareToAcceleratedCanvasUpgrade() && |
| 1243 source->IsAccelerated() && !Buffer()->IsAccelerated() && | 1245 source->IsAccelerated() && !Buffer()->IsAccelerated() && |
| 1244 ShouldAccelerate(kIgnoreResourceLimitCriteria)) { | 1246 ShouldAccelerate(kIgnoreResourceLimitCriteria)) { |
| 1245 OpacityMode opacity_mode = | 1247 OpacityMode opacity_mode = |
| 1246 context_->CreationAttributes().alpha() ? kNonOpaque : kOpaque; | 1248 context_->CreationAttributes().alpha() ? kNonOpaque : kOpaque; |
| 1247 int msaa_sample_count = 0; | 1249 int msaa_sample_count = 0; |
| 1248 std::unique_ptr<ImageBufferSurface> surface = | 1250 std::unique_ptr<ImageBufferSurface> surface = |
| 1249 CreateAcceleratedImageBufferSurface(opacity_mode, &msaa_sample_count); | 1251 CreateAcceleratedImageBufferSurface(opacity_mode, &msaa_sample_count); |
| 1250 if (surface) { | 1252 if (surface) { |
| 1251 Buffer()->SetSurface(std::move(surface)); | 1253 Buffer()->SetSurface(std::move(surface)); |
| 1252 SetNeedsCompositingUpdate(); | 1254 SetNeedsCompositingUpdate(); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 // Creates a placeholder layer first before Surface is created. | 1479 // Creates a placeholder layer first before Surface is created. |
| 1478 surface_layer_bridge_->CreateSolidColorLayer(); | 1480 surface_layer_bridge_->CreateSolidColorLayer(); |
| 1479 } | 1481 } |
| 1480 } | 1482 } |
| 1481 | 1483 |
| 1482 void HTMLCanvasElement::OnWebLayerReplaced() { | 1484 void HTMLCanvasElement::OnWebLayerReplaced() { |
| 1483 SetNeedsCompositingUpdate(); | 1485 SetNeedsCompositingUpdate(); |
| 1484 } | 1486 } |
| 1485 | 1487 |
| 1486 } // namespace blink | 1488 } // namespace blink |
| OLD | NEW |