OSDN Git Service

Merge "New setLocalMatrix() operation for HWUI" into mnc-dev
[android-x86/frameworks-base.git] / libs / hwui / OpenGLRenderer.cpp
index 87ed84f..2292ef4 100644 (file)
@@ -1670,10 +1670,10 @@ void OpenGLRenderer::drawBitmap(const SkBitmap* bitmap, Rect src, Rect dst, cons
     if (!texture) return;
     const AutoTexture autoCleanup(texture);
 
-    Rect uv(fmax(0.0f, src.left / texture->width),
-            fmax(0.0f, src.top / texture->height),
-            fmin(1.0f, src.right / texture->width),
-            fmin(1.0f, src.bottom / texture->height));
+    Rect uv(std::max(0.0f, src.left / texture->width),
+            std::max(0.0f, src.top / texture->height),
+            std::min(1.0f, src.right / texture->width),
+            std::min(1.0f, src.bottom / texture->height));
 
     const int textureFillFlags = (bitmap->colorType() == kAlpha_8_SkColorType)
             ? TextureFillFlags::IsAlphaMaskTexture : TextureFillFlags::None;
@@ -2148,6 +2148,7 @@ void OpenGLRenderer::restoreToCount(int saveCount) {
     mState.restoreToCount(saveCount);
 }
 
+
 void OpenGLRenderer::translate(float dx, float dy, float dz) {
     mState.translate(dx, dy, dz);
 }
@@ -2168,6 +2169,11 @@ void OpenGLRenderer::setMatrix(const Matrix4& matrix) {
     mState.setMatrix(matrix);
 }
 
+void OpenGLRenderer::setLocalMatrix(const SkMatrix& matrix) {
+    mState.setMatrix(mBaseTransform);
+    mState.concatMatrix(matrix);
+}
+
 void OpenGLRenderer::concatMatrix(const Matrix4& matrix) {
     mState.concatMatrix(matrix);
 }
@@ -2450,7 +2456,7 @@ void OpenGLRenderer::drawTextDecorations(float underlineWidth, float x, float y,
 
         if (CC_LIKELY(underlineWidth > 0.0f)) {
             const float textSize = paintCopy.getTextSize();
-            const float strokeWidth = fmax(textSize * kStdUnderline_Thickness, 1.0f);
+            const float strokeWidth = std::max(textSize * kStdUnderline_Thickness, 1.0f);
 
             const float left = x;
             float top = 0.0f;