vec2 pack16(float num) { int iz = int(num); int ir = intMod(iz,256); int ig = (iz)/256; vec2 res; res.r = float(ir)/255.0; res.g = float(ig)/255.0; return res; }
LayoutUnit LayoutMultiColumnSet::pageRemainingLogicalHeightForOffset(LayoutUnit offsetInFlowThread, PageBoundaryRule pageBoundaryRule) const { const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread); LayoutUnit pageLogicalHeight = row.logicalHeight(); ASSERT(pageLogicalHeight); // It's not allowed to call this method if the height is unknown. LayoutUnit pageLogicalBottom = row.columnLogicalTopForOffset(offsetInFlowThread) + pageLogicalHeight; LayoutUnit remainingLogicalHeight = pageLogicalBottom - offsetInFlowThread; if (pageBoundaryRule == AssociateWithFormerPage) { // An offset exactly at a column boundary will act as being part of the former column in // question (i.e. no remaining space), rather than being part of the latter (i.e. one whole // column length of remaining space). remainingLogicalHeight = intMod(remainingLogicalHeight, pageLogicalHeight); } return remainingLogicalHeight; }
LayoutUnit RenderFlowThread::pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule pageBoundaryRule) const { RenderRegion* region = regionAtBlockOffset(offset); if (!region) return 0; LayoutUnit pageLogicalTop = region->pageLogicalTopForOffset(offset); LayoutUnit pageLogicalHeight = region->pageLogicalHeight(); LayoutUnit pageLogicalBottom = pageLogicalTop + pageLogicalHeight; LayoutUnit remainingHeight = pageLogicalBottom - offset; if (pageBoundaryRule == IncludePageBoundary) { // If IncludePageBoundary is set, the line exactly on the top edge of a // region will act as being part of the previous region. remainingHeight = intMod(remainingHeight, pageLogicalHeight); } return remainingHeight; }
LayoutUnit RenderFlowThread::pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule pageBoundaryRule) { RenderMultiColumnSet* columnSet = columnSetAtBlockOffset(offset); if (!columnSet) return 0; LayoutUnit pageLogicalTop = columnSet->pageLogicalTopForOffset(offset); LayoutUnit pageLogicalHeight = columnSet->pageLogicalHeight(); LayoutUnit pageLogicalBottom = pageLogicalTop + pageLogicalHeight; LayoutUnit remainingHeight = pageLogicalBottom - offset; if (pageBoundaryRule == IncludePageBoundary) { // If IncludePageBoundary is set, the line exactly on the top edge of a // columnSet will act as being part of the previous columnSet. remainingHeight = intMod(remainingHeight, pageLogicalHeight); } return remainingHeight; }
extern "C" Box* intDivmod(BoxedInt* lhs, Box* rhs) { if (!isSubclass(lhs->cls, int_cls)) raiseExcHelper(TypeError, "descriptor '__divmod__' requires a 'int' object but received a '%s'", getTypeName(lhs)); Box* divResult = intDiv(lhs, rhs); if (divResult == NotImplemented) { return NotImplemented; } Box* modResult = intMod(lhs, rhs); if (modResult == NotImplemented) { return NotImplemented; } Box* arg[2] = { divResult, modResult }; return createTuple(2, arg); }
LayoutUnit LayoutMultiColumnSet::pageRemainingLogicalHeightForOffset(LayoutUnit offsetInFlowThread, PageBoundaryRule pageBoundaryRule) const { const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread); LayoutUnit pageLogicalHeight = row.logicalHeight(); ASSERT(pageLogicalHeight); // It's not allowed to call this method if the height is unknown. LayoutUnit pageLogicalBottom = row.columnLogicalTopForOffset(offsetInFlowThread) + pageLogicalHeight; LayoutUnit remainingLogicalHeight = pageLogicalBottom - offsetInFlowThread; if (pageBoundaryRule == AssociateWithFormerPage) { // An offset exactly at a column boundary will act as being part of the former column in // question (i.e. no remaining space), rather than being part of the latter (i.e. one whole // column length of remaining space). remainingLogicalHeight = intMod(remainingLogicalHeight, pageLogicalHeight); } else if (!remainingLogicalHeight) { // When pageBoundaryRule is AssociateWithLatterPage, we should never return 0, because if // there's no space left, it means that we should be at a column boundary, in which case we // should return the amount of space remaining in the *next* column. But this is not true if // the offset is "infinite" (saturated), so allow this to happen in that case. ASSERT(offsetInFlowThread.mightBeSaturated()); remainingLogicalHeight = pageLogicalHeight; } return remainingLogicalHeight; }
void main() { int i; int j; vec3 newCoords = vec3(0.0); j = int( volumePitch*volumePitch*TexCoord0.y ); newCoords.x = TexCoord0.x; newCoords.y = float(intMod(j,iVolumePitch))/volumePitch; newCoords.z = float(j/iVolumePitch)/volumePitch; vec4 res = texture2D( Texture0, v_TexCoords ); res = max(res,texture2D( Texture0, v_TexCoords+vec2(0.0/bufferDim.x,1.0/bufferDim.y) )); res = max(res,texture2D( Texture0, v_TexCoords+vec2(1.0/bufferDim.x,0.0/bufferDim.y) )); res = max(res,texture2D( Texture0, v_TexCoords+vec2(1.0/bufferDim.x,1.0/bufferDim.y) )); gl_FragData[0] = res; }