| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "public/platform/WebCompositorSupport.h" | 50 #include "public/platform/WebCompositorSupport.h" |
| 51 #include "public/platform/WebFilterOperations.h" | 51 #include "public/platform/WebFilterOperations.h" |
| 52 #include "public/platform/WebFloatPoint.h" | 52 #include "public/platform/WebFloatPoint.h" |
| 53 #include "public/platform/WebFloatRect.h" | 53 #include "public/platform/WebFloatRect.h" |
| 54 #include "public/platform/WebLayer.h" | 54 #include "public/platform/WebLayer.h" |
| 55 #include "public/platform/WebPoint.h" | 55 #include "public/platform/WebPoint.h" |
| 56 #include "public/platform/WebSize.h" | 56 #include "public/platform/WebSize.h" |
| 57 #include "wtf/CurrentTime.h" | 57 #include "wtf/CurrentTime.h" |
| 58 #include "wtf/HashMap.h" | 58 #include "wtf/HashMap.h" |
| 59 #include "wtf/HashSet.h" | 59 #include "wtf/HashSet.h" |
| 60 #include "wtf/MathExtras.h" |
| 60 #include "wtf/text/StringUTF8Adaptor.h" | 61 #include "wtf/text/StringUTF8Adaptor.h" |
| 61 #include "wtf/text/WTFString.h" | 62 #include "wtf/text/WTFString.h" |
| 62 #include <algorithm> | 63 #include <algorithm> |
| 64 #include <cmath> |
| 65 #include <utility> |
| 63 | 66 |
| 64 #ifndef NDEBUG | 67 #ifndef NDEBUG |
| 65 #include <stdio.h> | 68 #include <stdio.h> |
| 66 #endif | 69 #endif |
| 67 | 70 |
| 68 namespace blink { | 71 namespace blink { |
| 69 | 72 |
| 70 static bool s_drawDebugRedFill = true; | 73 static bool s_drawDebugRedFill = true; |
| 71 | 74 |
| 72 // TODO(wangxianzhu): Remove this when we no longer invalidate rects. | 75 // TODO(wangxianzhu): Remove this when we no longer invalidate rects. |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 } | 983 } |
| 981 | 984 |
| 982 void GraphicsLayer::setBackfaceVisibility(bool visible) | 985 void GraphicsLayer::setBackfaceVisibility(bool visible) |
| 983 { | 986 { |
| 984 m_backfaceVisibility = visible; | 987 m_backfaceVisibility = visible; |
| 985 platformLayer()->setDoubleSided(m_backfaceVisibility); | 988 platformLayer()->setDoubleSided(m_backfaceVisibility); |
| 986 } | 989 } |
| 987 | 990 |
| 988 void GraphicsLayer::setOpacity(float opacity) | 991 void GraphicsLayer::setOpacity(float opacity) |
| 989 { | 992 { |
| 990 float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); | 993 float clampedOpacity = clampTo(opacity, 0.0f, 1.0f); |
| 991 m_opacity = clampedOpacity; | 994 m_opacity = clampedOpacity; |
| 992 platformLayer()->setOpacity(opacity); | 995 platformLayer()->setOpacity(opacity); |
| 993 } | 996 } |
| 994 | 997 |
| 995 void GraphicsLayer::setBlendMode(WebBlendMode blendMode) | 998 void GraphicsLayer::setBlendMode(WebBlendMode blendMode) |
| 996 { | 999 { |
| 997 if (m_blendMode == blendMode) | 1000 if (m_blendMode == blendMode) |
| 998 return; | 1001 return; |
| 999 m_blendMode = blendMode; | 1002 m_blendMode = blendMode; |
| 1000 platformLayer()->setBlendMode(blendMode); | 1003 platformLayer()->setBlendMode(blendMode); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 { | 1253 { |
| 1251 if (!layer) { | 1254 if (!layer) { |
| 1252 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1255 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
| 1253 return; | 1256 return; |
| 1254 } | 1257 } |
| 1255 | 1258 |
| 1256 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1259 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1257 fprintf(stderr, "%s\n", output.utf8().data()); | 1260 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1258 } | 1261 } |
| 1259 #endif | 1262 #endif |
| OLD | NEW |