| 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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 // Allocating too many GPU resources can makes us run into the driver's | 843 // Allocating too many GPU resources can makes us run into the driver's |
| 844 // resource limits. So we need to keep the number of texture resources | 844 // resource limits. So we need to keep the number of texture resources |
| 845 // under tight control | 845 // under tight control |
| 846 if (ImageBuffer::getGlobalAcceleratedImageBufferCount() >= | 846 if (ImageBuffer::getGlobalAcceleratedImageBufferCount() >= |
| 847 MaxGlobalAcceleratedImageBufferCount) | 847 MaxGlobalAcceleratedImageBufferCount) |
| 848 return false; | 848 return false; |
| 849 | 849 |
| 850 return true; | 850 return true; |
| 851 } | 851 } |
| 852 | 852 |
| 853 namespace { |
| 854 |
| 853 class UnacceleratedSurfaceFactory | 855 class UnacceleratedSurfaceFactory |
| 854 : public RecordingImageBufferFallbackSurfaceFactory { | 856 : public RecordingImageBufferFallbackSurfaceFactory { |
| 855 public: | 857 public: |
| 856 virtual std::unique_ptr<ImageBufferSurface> createSurface( | 858 virtual std::unique_ptr<ImageBufferSurface> createSurface( |
| 857 const IntSize& size, | 859 const IntSize& size, |
| 858 OpacityMode opacityMode, | 860 OpacityMode opacityMode, |
| 859 sk_sp<SkColorSpace> colorSpace, | 861 sk_sp<SkColorSpace> colorSpace, |
| 860 SkColorType colorType) { | 862 SkColorType colorType) { |
| 861 return WTF::wrapUnique(new UnacceleratedImageBufferSurface( | 863 return WTF::wrapUnique(new UnacceleratedImageBufferSurface( |
| 862 size, opacityMode, InitializeImagePixels, colorSpace, colorType)); | 864 size, opacityMode, InitializeImagePixels, colorSpace, colorType)); |
| 863 } | 865 } |
| 864 | 866 |
| 865 virtual ~UnacceleratedSurfaceFactory() {} | 867 virtual ~UnacceleratedSurfaceFactory() {} |
| 866 }; | 868 }; |
| 867 | 869 |
| 870 } // namespace |
| 871 |
| 868 bool HTMLCanvasElement::shouldUseDisplayList(const IntSize& deviceSize) { | 872 bool HTMLCanvasElement::shouldUseDisplayList(const IntSize& deviceSize) { |
| 869 if (m_context->colorSpace() != kLegacyCanvasColorSpace) | 873 if (m_context->colorSpace() != kLegacyCanvasColorSpace) |
| 870 return false; | 874 return false; |
| 871 | 875 |
| 872 if (RuntimeEnabledFeatures::forceDisplayList2dCanvasEnabled()) | 876 if (RuntimeEnabledFeatures::forceDisplayList2dCanvasEnabled()) |
| 873 return true; | 877 return true; |
| 874 | 878 |
| 875 if (!RuntimeEnabledFeatures::displayList2dCanvasEnabled()) | 879 if (!RuntimeEnabledFeatures::displayList2dCanvasEnabled()) |
| 876 return false; | 880 return false; |
| 877 | 881 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); | 1406 m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this)); |
| 1403 // Creates a placeholder layer first before Surface is created. | 1407 // Creates a placeholder layer first before Surface is created. |
| 1404 m_surfaceLayerBridge->createSolidColorLayer(); | 1408 m_surfaceLayerBridge->createSolidColorLayer(); |
| 1405 } | 1409 } |
| 1406 | 1410 |
| 1407 void HTMLCanvasElement::OnWebLayerReplaced() { | 1411 void HTMLCanvasElement::OnWebLayerReplaced() { |
| 1408 setNeedsCompositingUpdate(); | 1412 setNeedsCompositingUpdate(); |
| 1409 } | 1413 } |
| 1410 | 1414 |
| 1411 } // namespace blink | 1415 } // namespace blink |
| OLD | NEW |